<?php

/**
 * This is the model class for table "view_check_request".
 *
 * The followings are the available columns in table 'view_check_request':
 * @property string $trans_date
 * @property integer $artist_id
 * @property string $artist_name
 * @property string $address_line1
 * @property string $address_line2
 * @property string $csz
 * @property string $office_ph
 * @property string $home_ph
 * @property string $cell_ph
 * @property string $sku
 * @property integer $qty
 * @property string $descr
 * @property string $payment
 */
class ViewCheckRequest extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return ViewCheckRequest the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'view_check_request';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('trans_date, sku, qty, descr', 'required'),
			array('artist_id, qty', 'numerical', 'integerOnly'=>true),
			array('artist_name', 'length', 'max'=>167),
			array('address_line1, sku, descr', 'length', 'max'=>55),
			array('address_line2', 'length', 'max'=>111),
			array('csz', 'length', 'max'=>65),
			array('office_ph, home_ph, cell_ph', 'length', 'max'=>10),
			array('payment', 'length', 'max'=>21),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('trans_date, artist_id, artist_name, address_line1, address_line2, csz, office_ph, home_ph, cell_ph, sku, qty, descr, payment', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'trans_date' => 'Trans Date',
			'artist_id' => 'Artist',
			'artist_name' => 'Artist Name',
			'address_line1' => 'Address Line1',
			'address_line2' => 'Address Line2',
			'csz' => 'Csz',
			'office_ph' => 'Office Ph',
			'home_ph' => 'Home Ph',
			'cell_ph' => 'Cell Ph',
			'sku' => 'Sku',
			'qty' => 'Qty',
			'descr' => 'Descr',
			'payment' => 'Payment',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('trans_date',$this->trans_date,true);
		$criteria->compare('artist_id',$this->artist_id);
		$criteria->compare('artist_name',$this->artist_name,true);
		$criteria->compare('address_line1',$this->address_line1,true);
		$criteria->compare('address_line2',$this->address_line2,true);
		$criteria->compare('csz',$this->csz,true);
		$criteria->compare('office_ph',$this->office_ph,true);
		$criteria->compare('home_ph',$this->home_ph,true);
		$criteria->compare('cell_ph',$this->cell_ph,true);
		$criteria->compare('sku',$this->sku,true);
		$criteria->compare('qty',$this->qty);
		$criteria->compare('descr',$this->descr,true);
		$criteria->compare('payment',$this->payment,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}